used to dynamically add servlet, filter, and listener.
4. added direct support for file upload to javax. servlet. HTTP. httpservletrequest added the getpart and getparts methods and added javax. servlet. HTTP. in fact, this function should be provided early to unify the file upload interface.
5. Package the JSP file as a resource file to the jar package and deploy it directly to the WEB-INF/lib directory, which has many benefits to the project of pro
Response.setcontenttype ("Text/html;charset=utf-8");
Final PrintWriter out=response.getwriter (); Out.println ("
Calling listeners asynchronously
When we need to do a detailed listener for an asynchronous call, such as listening for a timeout, we can do this by setting the corresponding listener Asynclistener to the Asynccontext. Asynclistener is an interface that defines four methods, respectively, for the start, end, error, and timeout of an asynchronous call.
(3) File upload
Uplo
input parameter or an output parameter. By default, all parameters are input. The output parameter value is set in the stored procedure. After the stored procedure is executed, it is read by the calling function.The processing of stored procedure parameters is the same as that of other SQL statements. Their names start with @, for example, @ departmentid. The simplest syntax for assigning values to output parameters in a stored procedure is as follows:Select @ resolve mentid = 5The following is
uploaded to a file: getPart (), getParts ()
O attribute
Attribute is the container setting or application setting. The method is setAttribute (), getAttributeXxx ()
Attribute names starting with java, javax, and sun are retained
SSL-related attributes, which are provided by the container in the form of attributes
Determine whether SSL: isSecure ()
O HTTP header: getHeaderXxx (), getXxxHeader ()
O Request Path
The request path consists of three par
Previously, the process of uploading files was always a headache for developers, because the Servlet itself did not provide direct support, needed to be implemented using a third-party framework, and was not easy to use. Servlet 3.0 already provides this functionality and is very simple to use. To do this, HttpServletRequest provides two methods to parse the uploaded file from the request:? Part GetPart (String name) ? collectionpart> getparts ()The f
, Listener, etc.4. Added direct support for file uploads, Add the Getpart and GetParts method to Javax.servlet.http.HttpServletRequest, and add the Javax.servlet.http.Part interface, which should have provided this feature earlier, the unified file upload interface.5. The JSP file is packaged into a jar package as a resource file and deployed directly to the Web-inf/lib directory, which has many benefits for the product development project. The JSP fi
Servlet provides three methods for uploading files.
Summary of three methods for uploading files using Servlet
1. Get the uploaded file through getInputStream.
/*** To change this template, choose Tools | Templates * and open the template in the editor. */package net. individuals. web. servlet; import java. io. dataInputStream; import java. io. fileOutputStream; import java. io. IOException; import javax. servlet. servletException; import javax. servlet. annotation. webServlet; import javax. ser
connects to the Web Service of the server. Therefore, during each startup, the dropdown list should be initialized in sequence, and each dropdown list will call the Web service once, while the Web Service is very slow. Slow startup speed.
To speed up, I adjusted data connect to create a web service for all the dropdown lists and added the original results returned for each web service to the root of an XML file, you only need to call it once during the entire startup process.
For example, I
(filestream, DEST );}}}} The decompressed code is as follows: Code
Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> Private Static Void Decompression ( String Filename){Zippackage zipfile;Zipfile = Zippackage. Open (filename, filemode. open) As Zippackage; Foreach (Zippackagepart part In Zipfile. getparts ()){Stream stream = Part. getstream (); Long Buffersize = Stream. Leng
(zipfilename, filemode. openorcreate ))
21
{
22
String
Destfilename
=
"
.\\
"
+
Path. getfilename (filetoadd );
23
Uri URI
=
Packurihelper. createparturi (
New
Uri (destfilename, urikind. Relative ));
24
If
(Zip. partexists (URI ))
25
{
26
Zip. deletepart (URI );
27
}
28
Packagepart part
=
Zip. createpart (Uri,
""
, Compressionoption. Normal );
29
Using
(Filestream
=
New
Filestream (filetoadd, filemode
Contact Us
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.